export default function ({
  xData = ['消防烟感', '摄像机', '环境烟感', '路灯', '地磁'],
  yData = [21, 43, 56, 32, 640],
  color = '#34C8FE',
  unit = '万吨',
} = {}) {
  return {
    backgroundColor: 'transparent',
    animation: true,
    grid: {
      top: '15%',
      bottom: '15%',
      right: '5%',
    },
    title: {
      subtext: unit,
    },
    xAxis: {
      data: xData,
      axisLine: {
        show: false, //隐藏X轴轴线
      },
      axisTick: {
        show: false, //隐藏X轴轴线
      },
      splitLine: {
        show: false,
        lineStyle: {
          color: 'rgba(77, 128, 254, 0.2)',
          width: 2,
        },
      },
      axisLabel: {
        show: true,
        margin: 14,
        fontSize: 16,
        textStyle: {
          color: '#9FB6BA', //X轴文字颜色
        },
      },
    },
    yAxis: [
      {
        type: 'value',
        gridIndex: 0,
        min: 0,
        splitLine: {
          show: true,
          lineStyle: {
            color: '#254246',
            width: 1,
          },
        },
        axisTick: {
          show: false,
        },
        axisLine: {
          show: false,
          lineStyle: {
            color: 'rgba(77, 128, 254, 0.2)',
          },
        },
        axisLabel: {
          show: true,
          margin: 14,
          fontSize: 16,
          textStyle: {
            color: '#9FB6BA',
          },
        },
      },
    ],
    series: [
      {
        name: '设备在线率',
        type: 'bar',
        barWidth: 16,
        itemStyle: {
          color,
        },
        data: yData,
        z: 10,
        zlevel: 0,
      },
      {
        // 分隔
        type: 'pictorialBar',
        itemStyle: {
          normal: {
            color: '#0F375F',
          },
        },
        symbolRepeat: 'fixed',
        symbolMargin: 6,
        symbol: 'rect',
        symbolClip: true,
        symbolSize: [18, 2],
        symbolPosition: 'start',
        symbolOffset: [1, 1],
        data: yData,
        width: 2,
        z: 0,
        zlevel: 1,
      },
    ],
    dataZoom: [
      {
        type: 'slider',
        show: false,
        xAxisIndex: [0],
        endValue: 4,
        startValue: 0,
      },
    ],
  };
}
